<?php
session_start();

include_once("../../Misc.php");
include_once("../../classCol/UID.php");
include_once("../../classCol/classOracleDb.php");
include_once("../../helpers/CHtml.php");
include_once("../../helpers/Composer.php");
include_once("../../helpers/ComposerSourceDb.php");
include_once("../models/fetchers.php");

$GHtml      = new CGHtml;
$CLFetchers = new CLFetchers;
$SourceDb   = new Composer;
$SourceDb   = $SourceDb->init("db");

$SourceDb->add("srcDbMstModel",      "MST_MODEL");
$SourceDb->add("srcDbMstConvertion", "MST_CONVERTION");

$Db = new oracleDb;
$Db->init($_SESSION["ORCL"],
          $_SESSION["OPASS"],
          $_SESSION["SID"],
          _NO_COMMENT);

if($Db->connect()){

  $CLFetchers->fetchModelUnit($Db,
                              $_POST["model"],
                              $SourceDb,
                              $unitFrom,
                              $unitTo);

  switch($_POST["from"]){

    case "1":

      $GHtml->initDropDownContent($unitFrom,
                                  "",
                                  $retContent);
      break;

    case "0":

      $GHtml->initDropDownContent($unitTo,
                                  "",
                                  $retContent);
      break;

    default:
  }

  echo  $retContent;

  $Db->dc();
}else{

  echo _CONN_ERROR;
}

?>